Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MessageInfo argument from migrate entry point #709

Merged
merged 13 commits into from
Jan 20, 2021

Conversation

juggernaut09
Copy link
Contributor

@juggernaut09 juggernaut09 commented Jan 12, 2021

Closes #690

  • Changed the function signature of fn migrate as fn query. (Removed the MessageInfo). in both hackatom and burner contracts.
  • Changed the struct member verifier to payout as referenced by @webmaster128. in hackatom contract.
  • Updated the json schema of MigrateMsg (migrate_msg.json) in hackatom contract.
  • Update the entry points, both the macro(packages/std/src/entry_points.rs) and as well as the wrapper(packages/std/src/exports.rs).

Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x//spec/)
  • Added relevant rustdoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@juggernaut09 juggernaut09 marked this pull request as ready for review January 12, 2021 13:51
Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Could you rebase this work to the latest master?

@webmaster128 webmaster128 added the Breaking (interface) Breaks VM-contract interface, likely requires `cosmwasm_version` bump label Jan 12, 2021
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution

@juggernaut09
Copy link
Contributor Author

Looks good to me. Could you rebase this work to the latest master?

@webmaster128 can you please review it again. I have rebased it to latest master branch. Solved merge conflicts also.

@ethanfrey
Copy link
Member

Looks good to me. I would just add a CHANGELOG entry "removed info argument from migrate".
But Simon need to give the ✔️ to merge

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, except for this diff in Building.md.

Would you also do #715? Ideally we do #715 first (independent PR) because it will ensure the change here works as expected.

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you.

Now, why is #715 important? This PR (#709) changes the interface between VM and contract. The testing contract in packages/vm/testdata/hackatom_0.14.wasm is still the old one, i.e. incompatible. So updating packages/vm/testdata/hackatom_0.14.wasm should be required as part of this. However, this interface is not tested so this incompatibility is not detected by th CI.

@webmaster128 webmaster128 changed the title Issue#690 Remove MessageInfo argument from migrate entry point Jan 18, 2021
@juggernaut09
Copy link
Contributor Author

Looks good, thank you.

Now, why is #715 important? This PR (#709) changes the interface between VM and contract. The testing contract in packages/vm/testdata/hackatom_0.14.wasm is still the old one, i.e. incompatible. So updating packages/vm/testdata/hackatom_0.14.wasm should be required as part of this. However, this interface is not tested so this incompatibility is not detected by th CI.

Ohk @webmaster128 I will work on the issue #715 and raise a PR.

@webmaster128
Copy link
Member

Could you update this to the latest master (rebase or merge master into this). This probably leads to one failing test. We then re-compile the testing contract to make it work again.

Base automatically changed from master to main January 19, 2021 22:43
…e#690

pulling rebase code from remote main branch into local issue#690 after merging issue#715 code.
@juggernaut09
Copy link
Contributor Author

juggernaut09 commented Jan 20, 2021

Could you update this to the latest master (rebase or merge master into this). This probably leads to one failing test. We then re-compile the testing contract to make it work again.

@webmaster128 I have tried to remove info: MessageInfo from fn call_migrate_works in packages/vm/src/calls.rsIt is raising a signature error because of passing only env and msg to call_raw. as below
call_raw(instance, "migrate", &[env, msg], MAX_LENGTH_MIGRATE)

The error is Parameters of type [I32, I32] did not match signature [I32, I32, I32] -> [I32]"
It is causing by the following code snippet.
https://github.com/wasmerio/wasmer/blob/1.0.1/lib/api/src/externals/function.rs#L500-L506

@webmaster128
Copy link
Member

webmaster128 commented Jan 20, 2021

@juggernaut09 right, this is because the test contract packages/vm/testdata/hackatom_0.14.wasm needs to be recompiled when the interface between VM and contract changes. You can do this as followes (see https://github.com/CosmWasm/cosmwasm/blob/master/packages/vm/README.md#setup):

docker run --rm -v "$(pwd)":/code \
  --mount type=volume,source="devcontract_cache_hackatom",target=/code/contracts/hackatom/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  cosmwasm/rust-optimizer:0.10.7 ./contracts/hackatom \
  && cp artifacts/hackatom.wasm packages/vm/testdata/hackatom_0.14.wasm

After that, it should work. You will have to update some gas values in the tests after recompiling.

Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just the debug print

@webmaster128 webmaster128 added the automerge See mergify.io label Jan 20, 2021
@mergify mergify bot merged commit 7e68844 into CosmWasm:main Jan 20, 2021
@webmaster128
Copy link
Member

Thanks a lot for your contribution, @juggernaut09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge See mergify.io Breaking (interface) Breaks VM-contract interface, likely requires `cosmwasm_version` bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't pass MessageInfo to migrate
3 participants